package com.suxin.shiro.jwt.token;

import lombok.Data;
import org.apache.shiro.authc.AuthenticationToken;

/**
 * @author Tang
 * @classname JwtToken
 * @description [ 授权token ]
 * @date 2021/3/21 22:52
 */
@Data
public class JwtToken implements AuthenticationToken {

    private String token;

    private Object principal;

    private Object credentials;

    /**
     * 登录
     * @param principal
     * @param credentials
     */
    public JwtToken(String principal,String credentials) {
        this.principal = principal;
        this.credentials = credentials;
    }

    /**
     * jwt 解析
     * @param token
     * @param principal
     */
    public JwtToken(String token,Object principal,String credentials) {
        this.token = token;
        this.principal = principal;
        this.credentials = credentials;
    }

    @Override
    public Object getPrincipal() {
        return principal;
    }

    @Override
    public Object getCredentials() {
        return credentials;
    }
}